package com.coderman.common.starter.tianqing.qlexpress.service;

import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Description:
 * date: 2020/10/14
 *
 * @author fanchunshuai
 * @version 1.0.0
 * @since JDK 1.8
 */
@Service
public class QlExpressDataHelperService {

    private static ConcurrentHashMap<String,String> concurrentHashMap = new ConcurrentHashMap<>();

    /**
     * 将数据存入map容器中
     * @param dataId
     * @param groupId
     * @param content
     */
    public void addConfig(String dataId,String groupId,String content){
        String key = dataId+"-"+groupId;
        concurrentHashMap.put(key,content);
    }

    /**
     * 根据dataId 和 groupId获取配置内容
     * @param dataId
     * @param groupId
     * @return
     */
    public String getConfig(String dataId,String groupId){
        String key = dataId+"-"+groupId;
        return concurrentHashMap.get(key);
    }

}
